package com.woniuxy.controller;

import java.security.Principal;

import javax.servlet.http.HttpServletRequest;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.woniuxy.entity.User;

@Controller
@RequestMapping("/ss")
public class adminController {
	@RequestMapping("/admin")
	@ResponseBody
	public void set(HttpServletRequest request) {
		User user0 = (User)request.getAttribute("user");
		//获得当前登录的用户
		//Principal principal = request.getUserPrincipal();
		//User user = new User().setAccount(principal.getName());
		//SecurityUtils.getSubject().getPrincipal();
		
		Subject currentUser = SecurityUtils.getSubject();
		Session session = currentUser.getSession();
		session.getAttribute("user");
		System.out.println(session.getAttribute("user"));
	}

}
